import 'package:flutter/material.dart';

/**
 * 我的页面
 */

class MinePage extends StatefulWidget {
  //final double _appBarHeight = 150.0;

  MinePage({Key key}) : super(key: key);

  @override
  _MinePageState createState() => _MinePageState();
}

class _MinePageState extends State<MinePage> {
  final double _appBarHeight = 150.0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        // appBar: AppBar(
        //   leading: GestureDetector(
        //     onTap: () {
        //       PageJumpService.instance().goBack();
        //     },
        //     child: Icon(
        //       Icons.arrow_back_ios,
        //       size: 20,
        //       color: Color(0XFF231815),
        //     ),
        //   ),
        //   backgroundColor: ColorsRes.color_ffffff,
        //   title: Text(
        //     "${widget.name}- 学习练习",
        //     style: TextStyle(color: ColorsRes.color_000000),
        //   ),
        // ),
        body: CustomScrollView(
      slivers: [
        SliverAppBar(
          //title:Text("标题"),
          expandedHeight: 300.0, //合并的高度，默认是状态栏的高度加AppBar的高度
          floating: false, //滑动时是否悬浮
          pinned: true, //标题栏是否固定
          snap: false, //配合floating使用
          backgroundColor: Colors.cyan,
          // leading: IconButton(   //左侧的图标或文字，多为返回箭头
          //   icon: Icon(Icons.arrow_back),
          //   onPressed: (){
          //     print("点击了返回按钮");
          //   },
          // ),

          // actions: [  //标题右侧操作
          //   IconButton(
          //     icon:Icon(Icons.scanner) ,
          //    onPressed: (){
          //      print("点击扫一扫");
          //    }
          //   ),
          //   IconButton(
          //     icon:Icon(Icons.settings) ,
          //    onPressed: (){
          //      print("点击设置");
          //    }
          //   )
          // ],

          //flexibleSpace 可以理解为SliverAppBar的背景内容区
          flexibleSpace: FlexibleSpaceBar(
            //滑动标题上移动效果  去掉title 添加flexibleSpace
            //title: Text("liujia"),
            title:Container(
              //color: Colors.red,
              margin: EdgeInsets.only(top: 40),
              child: Text("liujia"),
            ),
            //centerTitle: true, //标题是否居中显示
            collapseMode: CollapseMode.parallax,  //pin
            //background: Image.asset(""), //背景图片沉浸式
            background: Stack(
              //fit: StackFit.expand, //使子Widget的大小和父组件一样大

              children: [
                DecoratedBox(
                  decoration: BoxDecoration(
                      gradient: LinearGradient(
                          begin: Alignment(0.0, -1.0),
                          end: Alignment(0.0, -0.4),
                          colors: const <Color>[
                        const Color(0x00000000),
                        const Color(0x00000000)
                      ])),
                ),

                //顶部右侧图标部分
                Positioned(
                  top: 40,
                  right: 20,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: [
                      IconButton(
                          icon: Icon(Icons.scanner),
                          color: Colors.white,
                          onPressed: () {
                            print("点击扫一扫");
                          }),
                      IconButton(
                          icon: Icon(Icons.settings),
                          color: Colors.white,
                          onPressed: () {
                            print("点击设置");
                          })
                    ],
                  ),
                ),

                Positioned(
                  top: 100,
                  child: Container(
                   // color: Colors.red,
                    width: MediaQuery.of(context).size.width,
                    padding: EdgeInsets.only(left: 20, right: 20),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Text(
                              "刘佳",
                              style: TextStyle(
                                  color: Colors.white, fontSize: 26.0),
                            ),
                  
                            Container(
                              margin: EdgeInsets.only(top: 15),
                              child: Row(
                                children: [
                                  GestureDetector(
                                    child: Icon(Icons.edit,
                                        size: 14, color: Colors.white),
                                    onTap: () {
                                      print("点击编辑按钮");
                                    },
                                  ),
                                  
                                  Padding(
                                    padding: EdgeInsets.only(left: 8),
                                    child: Text(
                                      "我的在线简历",
                                      style: TextStyle(
                                          color: Colors.white, fontSize: 14.0),
                                    ),
                                  )
                                ],
                              ),
                            )
                          ],
                        ),
                        Container(
                          child:  CircleAvatar(
                            radius: 35.0,
                            backgroundImage: NetworkImage(
                                'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3153405721,1524067674&fm=26&gp=0.jpg'),
                          ),
                        )
                      ],
                    ),
                  ),
                ),
             
                Positioned(
                  top: 180,
                  child: Container(
                   // color: Colors.green,

                    width: MediaQuery.of(context).size.width,
                    padding: EdgeInsets.only(top:40,left: 40,right: 40),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Column(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text("81",style: TextStyle(fontSize: 20,color: Colors.white)),
                             Text("沟通过",style: TextStyle(fontSize: 12,color: Colors.white)),
                          ],
                        ),
                        Column(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text("0",style: TextStyle(fontSize: 20,color: Colors.white)),
                             Text("面试",style: TextStyle(fontSize: 12,color: Colors.white)),
                          ],
                        ),
                        Column(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text("23",style: TextStyle(fontSize: 20,color: Colors.white)),
                             Text("已投简历",style: TextStyle(fontSize: 12,color: Colors.white)),
                          ],
                        ),
                        Column(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text("51",style: TextStyle(fontSize: 20,color: Colors.white)),
                             Text("收藏",style: TextStyle(fontSize: 12,color: Colors.white)),
                          ],
                        )
                      ],
                    ),
                  ),
                ),

                Positioned(
                  top: 220,
                  left: 20,
                  right: 20,
                  child: Container(
                    width: 400,
                    height: 500,
                    decoration: BoxDecoration(
                      color: Colors.white,
                        //borderRadius: BorderRadius.all(Radius.circular(4.0)),
                         borderRadius: BorderRadius.vertical(top: Radius.elliptical(10, 10)), // 也可控件一边圆角大小
                    ),
                  ))
              ],
            ),
          ),
        ),
        SliverFixedExtentList(
          itemExtent: 50.0,
          delegate: SliverChildBuilderDelegate(
              (context, index) => ListTile(
                    title: Text("Item $index"),
                  ),
              childCount: 30),
        )
      ],
    ));
  }
}